<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>wisdomOA</title>
  <meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
  <meta name="author" content="Vincent Garreau" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  
   <link rel="stylesheet" href="${request.contextPath}/statics/css/bootstrap.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/font-awesome.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/AdminLTE.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/all-skins.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/main.css">
  
  <link rel="stylesheet" media="screen" href="${request.contextPath}/statics/css/style.css">
  <link rel="stylesheet" type="text/css" href="${request.contextPath}/statics/css/reset.css"/>
</head>
<body>
<div id="particles-js">
		<div class="login" id="rrapp">
			<div class="login-top">
				登录
			</div>
			<div class="login-center clearfix">
				<div class="login-center-img"><img src="./statics/images/name.png"/></div>
				<div class="login-center-input">
					<input type="text" class="form-control" v-model="username" name="" value="" placeholder="请输入您的用户名" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的用户名'"/>
					<div class="login-center-input-text">用户名</div>
				</div>
			</div>
			<div class="login-center clearfix">
				<div class="login-center-img"><img src="./statics/images/password.png"/></div>
				<div class="login-center-input">
					<input type="password" name=""value="" class="form-control" v-model="password" placeholder="请输入您的密码" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的密码'"/>
					<div class="login-center-input-text">密码</div>
				</div>
			</div>
			
			<div class="login-center clearfix">
				<div class="login-center-img"><img src="./statics/images/password.png"/></div>
				<div class="login-center-input">
					<input type="text" class="form-control" v-model="captcha" @keyup.enter="login" placeholder="验证码" >
      				<img alt="如果看不清楚，请单击图片刷新！" class="pointer" :src="src" @click="refreshCode" style="margin-top: 10px;">
					<div class="login-center-input-text">验证码</div>
					<div style="margin-top:-16%;margin-left:75%;">
      					<input @click="refreshCode" type="button" style="outline:none;border-color: transparent;background-color:#fff; color:#6288E3; box-shadow:none;" value="换一组">
      				</div>
				</div>
			</div>
			
			<div class="login-button" @click="login">
				登陆
			</div>
		</div>
		<div class="sk-rotating-plane"></div>
</div>

<!-- scripts -->
<script src="${request.contextPath}/statics/libs/jquery.min.js"></script>
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
<script src="${request.contextPath}/statics/libs/bootstrap.min.js"></script>
<script src="${request.contextPath}/statics/libs/jquery.slimscroll.min.js"></script>
<script src="${request.contextPath}/statics/libs/fastclick.min.js"></script>
<script src="${request.contextPath}/statics/libs/app.js"></script>
<script src="${request.contextPath}/statics/js/particles.min.js"></script>
<script src="${request.contextPath}/statics/js/app.js"></script>
<script type="text/javascript">

var vm = new Vue({
	el:'#rrapp',
	data:{
		username: 'admin',
		password: 'admin',
		captcha: '',
		error: false,
		errorMsg: '',
		src: 'captcha.jpg'
	},
	beforeCreate: function(){
		if(self != top){
			top.location.href = self.location.href;
		}
	},
	methods: {
		refreshCode: function(){
			this.src = "captcha.jpg?t=" + $.now();
		},
		login: function (event) {
			var data = "username="+vm.username+"&password="+vm.password+"&captcha="+vm.captcha;
			$.ajax({
				type: "POST",
			    url: "sys/login",
			    data: data,
			    dataType: "json",
			    success: function(result){
					if(result.code == 0){//登录成功
						parent.location.href ='index.html';
					}else{
						vm.error = true;
						vm.errorMsg = result.msg;
						
						vm.refreshCode();
					}
				}
			});
		}
	}
});

</script>
</body>
</html>